package cz.worsik.android.test.rideshare.util.listener;

import android.app.Activity;
import android.support.v4.app.Fragment;
import android.view.Gravity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.TextView;
import android.widget.Toast;

import cz.worsik.android.test.rideshare.MainActivity;
import cz.worsik.android.test.rideshare.R;
import cz.worsik.android.test.rideshare.fragments.JizdyFragment;

/**
 * Created by 231260 on 29.5.14.
 */
public class RouteSelectedListener implements AdapterView.OnItemClickListener {

    private final MainActivity context;

    public RouteSelectedListener(MainActivity context) {
        this.context = context;
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
        String name = ((TextView) view.findViewById(R.id.route_name)).getText().toString();

        context.showToast("Vybrana trasa " + name);

        context.changeFragment(JizdyFragment.sectionNumber);
    }
}
